﻿using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Media;
using MouseExtender.Logic.Common;
using MouseExtender.Logic.Enums;
using MouseExtender.Resources;

namespace MouseExtender.Logic
{
    public static class Constants
    {
        public const string ApplicationName = "MouseExtender Alpha";
        public const string SettingsFileName = "MouseExtender.cfg";
        public const string LogFileName = "CriticalError.log";
        public const string RegistryStartupKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
        public const string RegistryStartupValue = "MouseExtender";
        public const string AutoStartCommandArg = "/Autostart";
        public const string UpdatedCommandArg = "/Updated";
        public const string DataContractNamespace = "http://MouseExtender/v1.0";
        public const string ThumbsFileName = "ExternalThumbs.db";
        public const string Http = "http://";
        public const string Https = "https://";
        public const string MeSiteUrl = "http://mouseextender.net/";
        public const string MeGoogleAnalyticsParams = "?utm_source=me_app";
        public static readonly List<string> ImageExtensions = new List<string>() { ".png", ".jpg", ".jpeg", ".bmp", ".gif" };
        public static readonly Regex UrlResourceRegex = new Regex(@"[a-z]+://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        public const string GraphicsCOMExceptionId = "0x88980406";
        public const string ReleaseNotesFileName = "ReleaseNotes.txt";

        public static class ResourcesUri
        {
            public const string MouseExtenderIcon = "/MouseExtender;component/Icons/mouse-extender.ico";
            public const string MouseExtenderUpdateIcon = "/MouseExtender;component/Icons/mouse-extender-updates.ico";
            public const string ItemBroken16x16 = "/MouseExtender;component/Images/file-broken-16x16.png";
            public const string ItemBroken32x32 = "/MouseExtender;component/Images/file-broken-32x32.png";
            public const string FileTypeUrl16x16 = "/MouseExtender;component/Images/file-type-url-16x16.png";
            public const string FileTypeUrl32x32 = "/MouseExtender;component/Images/file-type-url-32x32.png";
        }

        public static class ResourceKeys
        {
            public const string Launcher_FileNotExissMessageKey = "Messages_FileNotExist";
            public const string Enums_CheckUpdatesPeriodKey = "Enums_CheckUpdatesPeriod";
        }

        public static class FileFilters
        {
            public static readonly string AllFiles = UIResources.FileFilters_AllFiles;
            public static readonly string IconFilter = UIResources.FileFilters_Icons;
        }

        public static class Messages
        {
            public static readonly string ErrorMessage = UIResources.Messages_Error;
            public static readonly string NewVersionNotification = UIResources.Messages_NewVersionAvailable;
            public static readonly string NewVersionTitle = UIResources.Messages_NewVersionAvailableTitle;
            public static readonly string HaveLatestVersion = UIResources.Messages_LatestVersion;
            public static readonly string HaveLatestVersionTitle = UIResources.Messages_LatesVersionTitle;
            public static readonly string ReadyToInstall = UIResources.Messages_ReadyToInstall;
            public static readonly string ReadyToInstallTitle = UIResources.Messages_ReadyToInstallTitle;
            public static readonly string UpdatesInstalled = UIResources.Messages_NewVersionInstalled;
            public static readonly string UpdatesInstalledTitle = UIResources.Messages_NewVersionInstalledTitle;
            public static readonly string ErrorCheckUpdates = UIResources.Messages_UpdateError;
            public static readonly string GraphicsCOMException = "The issue is related to video drivers version.\r\nPlease, update your video drivers to the latest version and install (if you haven't install SP1 for .net) .net framework 3.5 with SP1";
        }

        public static class Defaults
        {
            public static readonly Color ItemColor = Color.FromArgb(0x00, 0x00, 0x00, 0x00);
            public static readonly Color BrokenItemColor = Colors.DarkRed;
            public const MouseExtenderButton MouseButton = MouseExtenderButton.MiddleButton;
        }

        public static readonly Dictionary<int, string> RestartOptionsDictionary = new Dictionary<int, string>()
        {
            {(int)RestartOptions.Hibernate, UIResources.Timer_Hibernate},
            {(int)RestartOptions.LogOff, UIResources.Timer_LogOff},
            {(int)RestartOptions.PowerOff, UIResources.Timer_PowerOff},
            {(int)RestartOptions.Reboot, UIResources.Timer_Restart},
            {(int)RestartOptions.ShutDown, UIResources.Timer_TurnOff},
            {(int)RestartOptions.Suspend, UIResources.Timer_Sleep},
        };
    }
}
